package com.gxa.list.controller;

import com.gxa.common.R;
import com.gxa.common.entity.platform_maintenance_service1001.Question;
import com.gxa.list.service.QuestionListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/questionList")
public class QusertionListController {

    @Autowired
    private QuestionListService questionListService;

    /**
     * 1.添加问题分类
     * @param question
     * @return
     */
    @PostMapping("/addQuestionList")
    public R addQuestionList(@RequestBody Question question){
        return questionListService.addQuestionList(question);
    }

    /**
     * 2.修改问题列表
     * @param question
     * @return
     */
    @PostMapping("/updateQuestionList")
    public R updateQuestionList(@RequestBody Question question){
        return questionListService.updateQuestionList(question);
    }

    /**
     * 3.分页查询
     */
    @GetMapping("/selectQuestionListByPage")
    public R selectQuestionListByPage(Integer currentPage,Integer pageSize){
        return questionListService.selectQuestionListByPage(currentPage,pageSize);
    }

    /**
     * 4.批量删除
     * @param ids
     * @return
     */
    @GetMapping("/delQuestionByIds")
    public R delQuestionByIds(@RequestParam List<Integer> ids){
        return questionListService.delQuestionByIds(ids);
    }

    /**
     * 5.按照条件查询

     * @return
     */
    @PostMapping("/selectQuestionByConditions")
    public R selectQuestionByConditions(@RequestBody Question question){

        return questionListService.selectQuestionByConditions(question);
    }

    /**
     * 6.修改状态
     * @param question
     * @return
     */
    @PostMapping("/disableQuestion")
    public R disableQuestion(@RequestBody Question question){
        return questionListService.disableQuestion(question);
    }

    /**
     * 7.根据id查询问题分类和列表信息
     */
    @PostMapping("/selectQuestionById")
    public R selectQuestionById(@RequestBody Question question){
        return  questionListService.selectQuestionById(question);
    }

    /**
     * 8.根据id问题分类查询问题列表
     * @param question
     * @return
     */
    @PostMapping("/selectTwoTableQuestion")
    public R selectTwoTableQuestion(@RequestBody Question question){
        return questionListService.selectTwoTableQuestion(question);
    }




}
